<html><head><title>TreePanel.js</title><link rel="stylesheet" type="text/css" href="../resources/style.css" media="screen"/></head><body><h1>TreePanel.js</h1><pre class="highlighted"><code><i>/**
 * @class Ext.tree.TreePanel
 * &lt;p&gt;The TreePanel provides tree-structured UI representation of tree-structured data.&lt;/p&gt;
 * &lt;p&gt;{@link Ext.tree.TreeNode TreeNode}s added to the TreePanel may each contain metadata
 * used by your application <b>in</b> their {@link Ext.tree.TreeNode#attributes attributes} property.&lt;/p&gt;
 * &lt;p&gt;&lt;b&gt;A TreePanel must have a {@link #root} node before it is rendered.&lt;/b&gt; This may either be
 * specified using the {@link #root} config option, or using the {@link #setRootNode} method.
 * @extends Ext.Panel

 * @cfg {Ext.tree.TreeNode} root The root node <b>for</b> the tree.
 * @cfg {Boolean} rootVisible false to hide the root node (defaults to true)
 * @cfg {Boolean} lines false to disable tree lines (defaults to true)
 * @cfg {Boolean} enableDD true to enable drag and drop
 * @cfg {Boolean} enableDrag true to enable just drag
 * @cfg {Boolean} enableDrop true to enable just drop
 * @cfg {Object} dragConfig Custom config to pass to the {@link Ext.tree.TreeDragZone} instance
 * @cfg {Object} dropConfig Custom config to pass to the {@link Ext.tree.TreeDropZone} instance
 * @cfg {String} ddGroup The DD group <b>this</b> TreePanel belongs to
 * @cfg {String} ddAppendOnly True <b>if</b> the tree should only allow append drops (use <b>for</b> trees which are sorted)
 * @cfg {Boolean} ddScroll true to enable body scrolling
 * @cfg {Boolean} containerScroll true to register <b>this</b> container <b>with</b> ScrollManager
 * @cfg {Boolean} hlDrop false to disable node highlight on drop (defaults to the value of Ext.enableFx)
 * @cfg {String} hlColor The color of the node highlight (defaults to C3DAF9)
 * @cfg {Boolean} animate true to enable animated expand/collapse (defaults to the value of Ext.enableFx)
 * @cfg {Boolean} singleExpand true <b>if</b> only 1 node per branch may be expanded
 * @cfg {Object} selModel A tree selection model to use <b>with</b> this TreePanel (defaults to a {@link Ext.tree.DefaultSelectionModel})
 * @cfg {Boolean} trackMouseOver False to disable mouse over highlighting 
 * @cfg {Ext.tree.TreeLoader} loader A {@link Ext.tree.TreeLoader} <b>for</b> use <b>with</b> this TreePanel
 * @cfg {String} pathSeparator The token used to separate sub-paths <b>in</b> path strings (defaults to <em>'/'</em>)
 * @cfg {Boolean} useArrows True to use Vista-style arrows <b>in</b> the tree (defaults to false)
 *
 * @constructor
 * @param {Object} config
 */</i>
Ext.tree.TreePanel = Ext.extend(Ext.Panel, {
    rootVisible : true,
    animate: Ext.enableFx,
    lines : true,
    enableDD : false,
    hlDrop : Ext.enableFx,
    pathSeparator: &quot;/&quot;,

    initComponent : <b>function</b>(){
        Ext.tree.TreePanel.superclass.initComponent.call(<b>this</b>);

        <b>if</b>(!<b>this</b>.eventModel){
            <b>this</b>.eventModel = <b>new</b> Ext.tree.TreeEventModel(<b>this</b>);
        }
        
        <i>// initialize the loader</i>
        <b>var</b> l = <b>this</b>.loader;
        <b>if</b>(!l){
            l = <b>new</b> Ext.tree.TreeLoader({
                dataUrl: <b>this</b>.dataUrl
            });
        }<b>else</b> if(<b>typeof</b> l == <em>'object'</em> &amp;&amp; !l.load){
            l = <b>new</b> Ext.tree.TreeLoader(l);
        }
        <b>this</b>.loader = l;
        
        <b>this</b>.nodeHash = {};

        <i>/**
        * The root node of <b>this</b> tree.
        * @type Ext.tree.TreeNode
        * @property root
        */</i>
        <b>if</b>(this.root){
           <b>this</b>.setRootNode(<b>this</b>.root);
        }

        <b>this</b>.addEvents(

            <i>/**
            * @event append
            * Fires when a <b>new</b> child node is appended to a node <b>in</b> this tree.
            * @param {Tree} tree The owner tree
            * @param {Node} parent The parent node
            * @param {Node} node The newly appended node
            * @param {Number} index The index of the newly appended node
            */</i>
           &quot;append&quot;,
           <i>/**
            * @event remove
            * Fires when a child node is removed from a node <b>in</b> this tree.
            * @param {Tree} tree The owner tree
            * @param {Node} parent The parent node
            * @param {Node} node The child node removed
            */</i>
           &quot;remove&quot;,
           <i>/**
            * @event movenode
            * Fires when a node is moved to a <b>new</b> location <b>in</b> the tree
            * @param {Tree} tree The owner tree
            * @param {Node} node The node moved
            * @param {Node} oldParent The old parent of <b>this</b> node
            * @param {Node} newParent The <b>new</b> parent of <b>this</b> node
            * @param {Number} index The index it was moved to
            */</i>
           &quot;movenode&quot;,
           <i>/**
            * @event insert
            * Fires when a <b>new</b> child node is inserted <b>in</b> a node <b>in</b> this tree.
            * @param {Tree} tree The owner tree
            * @param {Node} parent The parent node
            * @param {Node} node The child node inserted
            * @param {Node} refNode The child node the node was inserted before
            */</i>
           &quot;insert&quot;,
           <i>/**
            * @event beforeappend
            * Fires before a <b>new</b> child is appended to a node <b>in</b> this tree, <b>return</b> false to cancel the append.
            * @param {Tree} tree The owner tree
            * @param {Node} parent The parent node
            * @param {Node} node The child node to be appended
            */</i>
           &quot;beforeappend&quot;,
           <i>/**
            * @event beforeremove
            * Fires before a child is removed from a node <b>in</b> this tree, <b>return</b> false to cancel the remove.
            * @param {Tree} tree The owner tree
            * @param {Node} parent The parent node
            * @param {Node} node The child node to be removed
            */</i>
           &quot;beforeremove&quot;,
           <i>/**
            * @event beforemovenode
            * Fires before a node is moved to a <b>new</b> location <b>in</b> the tree. Return false to cancel the move.
            * @param {Tree} tree The owner tree
            * @param {Node} node The node being moved
            * @param {Node} oldParent The parent of the node
            * @param {Node} newParent The <b>new</b> parent the node is moving to
            * @param {Number} index The index it is being moved to
            */</i>
           &quot;beforemovenode&quot;,
           <i>/**
            * @event beforeinsert
            * Fires before a <b>new</b> child is inserted <b>in</b> a node <b>in</b> this tree, <b>return</b> false to cancel the insert.
            * @param {Tree} tree The owner tree
            * @param {Node} parent The parent node
            * @param {Node} node The child node to be inserted
            * @param {Node} refNode The child node the node is being inserted before
            */</i>
            &quot;beforeinsert&quot;,

            <i>/**
            * @event beforeload
            * Fires before a node is loaded, <b>return</b> false to cancel
            * @param {Node} node The node being loaded
            */</i>
            &quot;beforeload&quot;,
            <i>/**
            * @event load
            * Fires when a node is loaded
            * @param {Node} node The node that was loaded
            */</i>
            &quot;load&quot;,
            <i>/**
            * @event textchange
            * Fires when the text <b>for</b> a node is changed
            * @param {Node} node The node
            * @param {String} text The <b>new</b> text
            * @param {String} oldText The old text
            */</i>
            &quot;textchange&quot;,
            <i>/**
            * @event beforeexpandnode
            * Fires before a node is expanded, <b>return</b> false to cancel.
            * @param {Node} node The node
            * @param {Boolean} deep
            * @param {Boolean} anim
            */</i>
            &quot;beforeexpandnode&quot;,
            <i>/**
            * @event beforecollapsenode
            * Fires before a node is collapsed, <b>return</b> false to cancel.
            * @param {Node} node The node
            * @param {Boolean} deep
            * @param {Boolean} anim
            */</i>
            &quot;beforecollapsenode&quot;,
            <i>/**
            * @event expandnode
            * Fires when a node is expanded
            * @param {Node} node The node
            */</i>
            &quot;expandnode&quot;,
            <i>/**
            * @event disabledchange
            * Fires when the disabled status of a node changes
            * @param {Node} node The node
            * @param {Boolean} disabled
            */</i>
            &quot;disabledchange&quot;,
            <i>/**
            * @event collapsenode
            * Fires when a node is collapsed
            * @param {Node} node The node
            */</i>
            &quot;collapsenode&quot;,
            <i>/**
            * @event beforeclick
            * Fires before click processing on a node. Return false to cancel the <b>default</b> action.
            * @param {Node} node The node
            * @param {Ext.EventObject} e The event object
            */</i>
            &quot;beforeclick&quot;,
            <i>/**
            * @event click
            * Fires when a node is clicked
            * @param {Node} node The node
            * @param {Ext.EventObject} e The event object
            */</i>
            &quot;click&quot;,
            <i>/**
            * @event checkchange
            * Fires when a node <b>with</b> a checkbox's checked property changes
            * @param {Node} <b>this</b> This node
            * @param {Boolean} checked
            */</i>
            &quot;checkchange&quot;,
            <i>/**
            * @event dblclick
            * Fires when a node is double clicked
            * @param {Node} node The node
            * @param {Ext.EventObject} e The event object
            */</i>
            &quot;dblclick&quot;,
            <i>/**
            * @event contextmenu
            * Fires when a node is right clicked. To display a context menu <b>in</b> response to <b>this</b>
            * event, first create a Menu object (see {@link Ext.menu.Menu} <b>for</b> details), then add
            * a handler <b>for</b> this event:&lt;code&gt;&lt;pre&gt;
<b>new</b> Ext.tree.TreePanel({
    title: <em>'My TreePanel'</em>,
    root: <b>new</b> Ext.tree.AsyncTreeNode({
        text: <em>'The Root'</em>,
        children: [
            { text: <em>'Child node 1'</em>, leaf: true },
            { text: <em>'Child node 2'</em>, leaf: true }
        ]
    }),
    contextMenu: <b>new</b> Ext.menu.Menu({
        items: [{
            id: <em>'<b>delete</b>-node'</em>,
            text: <em>'Delete Node'</em>
        }],
        listeners: {
            itemclick: <b>function</b>(item) {
                <b>switch</b> (item.id) {
                    <b>case</b> <em>'<b>delete</b>-node'</em>:
                        <b>var</b> n = item.parentMenu.contextNode;
                        <b>if</b> (n.parentNode) {
                            n.remove();
                        }
                        <b>break</b>;
                }
            }
        }
    }),
    listeners: {
        contextmenu: <b>function</b>(node, e) {
<i>//          Register the context node <b>with</b> the menu so that a Menu Item's handler <b>function</b> can access</i>
<i>//          it via its {@link Ext.menu.BaseItem#parentMenu parentMenu} property.</i>
            node.select();
            <b>var</b> c = node.getOwnerTree().contextMenu;
            c.contextNode = node;
            c.showAt(e.getXY());
        }
    }
});
&lt;/pre&gt;&lt;/code&gt;
            * @param {Node} node The node
            * @param {Ext.EventObject} e The event object
            */</i>
            &quot;contextmenu&quot;,
            <i>/**
            * @event beforechildrenrendered
            * Fires right before the child nodes <b>for</b> a node are rendered
            * @param {Node} node The node
            */</i>
            &quot;beforechildrenrendered&quot;,
           <i>/**
             * @event startdrag
             * Fires when a node starts being dragged
             * @param {Ext.tree.TreePanel} <b>this</b>
             * @param {Ext.tree.TreeNode} node
             * @param {event} e The raw browser event
             */</i>
            &quot;startdrag&quot;,
            <i>/**
             * @event enddrag
             * Fires when a drag operation is complete
             * @param {Ext.tree.TreePanel} <b>this</b>
             * @param {Ext.tree.TreeNode} node
             * @param {event} e The raw browser event
             */</i>
            &quot;enddrag&quot;,
            <i>/**
             * @event dragdrop
             * Fires when a dragged node is dropped on a valid DD target
             * @param {Ext.tree.TreePanel} <b>this</b>
             * @param {Ext.tree.TreeNode} node
             * @param {DD} dd The dd it was dropped on
             * @param {event} e The raw browser event
             */</i>
            &quot;dragdrop&quot;,
            <i>/**
             * @event beforenodedrop
             * Fires when a DD object is dropped on a node <b>in</b> this tree <b>for</b> preprocessing. Return false to cancel the drop. The dropEvent
             * passed to handlers has the following properties:&lt;br /&gt;
             * &lt;ul style=&quot;padding:5px;padding-left:16px;&quot;&gt;
             * &lt;li&gt;tree - The TreePanel&lt;/li&gt;
             * &lt;li&gt;target - The node being targeted <b>for</b> the drop&lt;/li&gt;
             * &lt;li&gt;data - The drag data from the drag source&lt;/li&gt;
             * &lt;li&gt;point - The point of the drop - append, above or below&lt;/li&gt;
             * &lt;li&gt;source - The drag source&lt;/li&gt;
             * &lt;li&gt;rawEvent - Raw mouse event&lt;/li&gt;
             * &lt;li&gt;dropNode - Drop node(s) provided by the source &lt;b&gt;OR&lt;/b&gt; you can supply node(s)
             * to be inserted by setting them on <b>this</b> object.&lt;/li&gt;
             * &lt;li&gt;cancel - Set <b>this</b> to true to cancel the drop.&lt;/li&gt;
             * &lt;li&gt;dropStatus - If the <b>default</b> drop action is cancelled but the drop is valid, setting <b>this</b> to true
             * will prevent the animated &quot;repair&quot; from appearing.&lt;/li&gt;
             * &lt;/ul&gt;
             * @param {Object} dropEvent
             */</i>
            &quot;beforenodedrop&quot;,
            <i>/**
             * @event nodedrop
             * Fires after a DD object is dropped on a node <b>in</b> this tree. The dropEvent
             * passed to handlers has the following properties:&lt;br /&gt;
             * &lt;ul style=&quot;padding:5px;padding-left:16px;&quot;&gt;
             * &lt;li&gt;tree - The TreePanel&lt;/li&gt;
             * &lt;li&gt;target - The node being targeted <b>for</b> the drop&lt;/li&gt;
             * &lt;li&gt;data - The drag data from the drag source&lt;/li&gt;
             * &lt;li&gt;point - The point of the drop - append, above or below&lt;/li&gt;
             * &lt;li&gt;source - The drag source&lt;/li&gt;
             * &lt;li&gt;rawEvent - Raw mouse event&lt;/li&gt;
             * &lt;li&gt;dropNode - Dropped node(s).&lt;/li&gt;
             * &lt;/ul&gt;
             * @param {Object} dropEvent
             */</i>
            &quot;nodedrop&quot;,
             <i>/**
             * @event nodedragover
             * Fires when a tree node is being targeted <b>for</b> a drag drop, <b>return</b> false to signal drop not allowed. The dragOverEvent
             * passed to handlers has the following properties:&lt;br /&gt;
             * &lt;ul style=&quot;padding:5px;padding-left:16px;&quot;&gt;
             * &lt;li&gt;tree - The TreePanel&lt;/li&gt;
             * &lt;li&gt;target - The node being targeted <b>for</b> the drop&lt;/li&gt;
             * &lt;li&gt;data - The drag data from the drag source&lt;/li&gt;
             * &lt;li&gt;point - The point of the drop - append, above or below&lt;/li&gt;
             * &lt;li&gt;source - The drag source&lt;/li&gt;
             * &lt;li&gt;rawEvent - Raw mouse event&lt;/li&gt;
             * &lt;li&gt;dropNode - Drop node(s) provided by the source.&lt;/li&gt;
             * &lt;li&gt;cancel - Set <b>this</b> to true to signal drop not allowed.&lt;/li&gt;
             * &lt;/ul&gt;
             * @param {Object} dragOverEvent
             */</i>
            &quot;nodedragover&quot;
        );
        <b>if</b>(this.singleExpand){
            <b>this</b>.on(&quot;beforeexpandnode&quot;, <b>this</b>.restrictExpand, <b>this</b>);
        }
    },

    <i>// private</i>
    proxyNodeEvent : <b>function</b>(ename, a1, a2, a3, a4, a5, a6){
        <b>if</b>(ename == <em>'collapse'</em> || ename == <em>'expand'</em> || ename == <em>'beforecollapse'</em> || ename == <em>'beforeexpand'</em> || ename == <em>'move'</em> || ename == <em>'beforemove'</em>){
            ename = ename+<em>'node'</em>;
        }
        <i>// args inline <b>for</b> performance <b>while</b> bubbling events</i>
        <b>return</b> this.fireEvent(ename, a1, a2, a3, a4, a5, a6);
    },


    <i>/**
     * Returns <b>this</b> root node <b>for</b> this tree
     * @<b>return</b> {Node}
     */</i>
    getRootNode : <b>function</b>(){
        <b>return</b> this.root;
    },

    <i>/**
     * Sets the root node <b>for</b> this tree during initialization. 
     * @param {Node} node
     * @<b>return</b> {Node}
     */</i>
    setRootNode : <b>function</b>(node){
        <b>if</b>(!node.render){ <i>// attributes passed</i>
            node = <b>this</b>.loader.createNode(node);
        }
        <b>this</b>.root = node;
        node.ownerTree = <b>this</b>;
        node.isRoot = true;
        <b>this</b>.registerNode(node);
        <b>if</b>(!<b>this</b>.rootVisible){
        	<b>var</b> uiP = node.attributes.uiProvider;
        	node.ui = uiP ? <b>new</b> uiP(node) : <b>new</b> Ext.tree.RootTreeNodeUI(node); 
        }
        <b>return</b> node;
    },

    <i>/**
     * Gets a node <b>in</b> this tree by its id
     * @param {String} id
     * @<b>return</b> {Node}
     */</i>
    getNodeById : <b>function</b>(id){
        <b>return</b> this.nodeHash[id];
    },

    <i>// private</i>
    registerNode : <b>function</b>(node){
        <b>this</b>.nodeHash[node.id] = node;
    },

    <i>// private</i>
    unregisterNode : <b>function</b>(node){
        <b>delete</b> this.nodeHash[node.id];
    },

    <i>// private</i>
    toString : <b>function</b>(){
        <b>return</b> &quot;[Tree&quot;+(<b>this</b>.id?&quot; &quot;+<b>this</b>.id:&quot;&quot;)+&quot;]&quot;;
    },

    <i>// private</i>
    restrictExpand : <b>function</b>(node){
        <b>var</b> p = node.parentNode;
        <b>if</b>(p){
            <b>if</b>(p.expandedChild &amp;&amp; p.expandedChild.parentNode == p){
                p.expandedChild.collapse();
            }
            p.expandedChild = node;
        }
    },

    <i>/**
     * Retrieve an array of checked nodes, or an array of a specific attribute of checked nodes (e.g. &quot;id&quot;)
     * @param {String} attribute (optional) Defaults to null (<b>return</b> the actual nodes)
     * @param {TreeNode} startNode (optional) The node to start from, defaults to the root
     * @<b>return</b> {Array}
     */</i>
    getChecked : <b>function</b>(a, startNode){
        startNode = startNode || <b>this</b>.root;
        <b>var</b> r = [];
        <b>var</b> f = <b>function</b>(){
            <b>if</b>(this.attributes.checked){
                r.push(!a ? <b>this</b> : (a == <em>'id'</em> ? <b>this</b>.id : <b>this</b>.attributes[a]));
            }
        }
        startNode.cascade(f);
        <b>return</b> r;
    },

    <i>/**
     * Returns the container element <b>for</b> this TreePanel.
     * @<b>return</b> {Element} The container element <b>for</b> this TreePanel.
     */</i>
    getEl : <b>function</b>(){
        <b>return</b> this.el;
    },

    <i>/**
     * Returns the <b>default</b> {@link Ext.tree.TreeLoader} <b>for</b> this TreePanel.
     * @<b>return</b> {Ext.tree.TreeLoader} The TreeLoader <b>for</b> this TreePanel.
     */</i>
    getLoader : <b>function</b>(){
        <b>return</b> this.loader;
    },

    <i>/**
     * Expand all nodes
     */</i>
    expandAll : <b>function</b>(){
        <b>this</b>.root.expand(true);
    },

    <i>/**
     * Collapse all nodes
     */</i>
    collapseAll : <b>function</b>(){
        <b>this</b>.root.collapse(true);
    },

    <i>/**
     * Returns the selection model used by <b>this</b> TreePanel.
     * @<b>return</b> {TreeSelectionModel} The selection model used by <b>this</b> TreePanel
     */</i>
    getSelectionModel : <b>function</b>(){
        <b>if</b>(!<b>this</b>.selModel){
            <b>this</b>.selModel = <b>new</b> Ext.tree.DefaultSelectionModel();
        }
        <b>return</b> this.selModel;
    },

    <i>/**
     * Expands a specified path <b>in</b> this TreePanel. A path can be retrieved from a node <b>with</b> {@link Ext.data.Node#getPath}
     * @param {String} path
     * @param {String} attr (optional) The attribute used <b>in</b> the path (see {@link Ext.data.Node#getPath} <b>for</b> more info)
     * @param {Function} callback (optional) The callback to call when the expand is complete. The callback will be called <b>with</b>
     * (bSuccess, oLastNode) where bSuccess is <b>if</b> the expand was successful and oLastNode is the last node that was expanded.
     */</i>
    expandPath : <b>function</b>(path, attr, callback){
        attr = attr || &quot;id&quot;;
        <b>var</b> keys = path.split(<b>this</b>.pathSeparator);
        <b>var</b> curNode = <b>this</b>.root;
        <b>if</b>(curNode.attributes[attr] != keys[1]){ <i>// invalid root</i>
            <b>if</b>(callback){
                callback(false, null);
            }
            <b>return</b>;
        }
        <b>var</b> index = 1;
        <b>var</b> f = <b>function</b>(){
            <b>if</b>(++index == keys.length){
                <b>if</b>(callback){
                    callback(true, curNode);
                }
                <b>return</b>;
            }
            <b>var</b> c = curNode.findChild(attr, keys[index]);
            <b>if</b>(!c){
                <b>if</b>(callback){
                    callback(false, curNode);
                }
                <b>return</b>;
            }
            curNode = c;
            c.expand(false, false, f);
        };
        curNode.expand(false, false, f);
    },

    <i>/**
     * Selects the node <b>in</b> this tree at the specified path. A path can be retrieved from a node <b>with</b> {@link Ext.data.Node#getPath}
     * @param {String} path
     * @param {String} attr (optional) The attribute used <b>in</b> the path (see {@link Ext.data.Node#getPath} <b>for</b> more info)
     * @param {Function} callback (optional) The callback to call when the selection is complete. The callback will be called <b>with</b>
     * (bSuccess, oSelNode) where bSuccess is <b>if</b> the selection was successful and oSelNode is the selected node.
     */</i>
    selectPath : <b>function</b>(path, attr, callback){
        attr = attr || &quot;id&quot;;
        <b>var</b> keys = path.split(<b>this</b>.pathSeparator);
        <b>var</b> v = keys.pop();
        <b>if</b>(keys.length &gt; 0){
            <b>var</b> f = <b>function</b>(success, node){
                <b>if</b>(success &amp;&amp; node){
                    <b>var</b> n = node.findChild(attr, v);
                    <b>if</b>(n){
                        n.select();
                        <b>if</b>(callback){
                            callback(true, n);
                        }
                    }<b>else</b> if(callback){
                        callback(false, n);
                    }
                }<b>else</b>{
                    <b>if</b>(callback){
                        callback(false, n);
                    }
                }
            };
            <b>this</b>.expandPath(keys.join(<b>this</b>.pathSeparator), attr, f);
        }<b>else</b>{
            <b>this</b>.root.select();
            <b>if</b>(callback){
                callback(true, <b>this</b>.root);
            }
        }
    },

    <i>/**
     * Returns the underlying Element <b>for</b> this tree
     * @<b>return</b> {Ext.Element} The Element
     */</i>
    getTreeEl : <b>function</b>(){
        <b>return</b> this.body;
    },

    <i>// private</i>
    onRender : <b>function</b>(ct, position){
        Ext.tree.TreePanel.superclass.onRender.call(<b>this</b>, ct, position);
        <b>this</b>.el.addClass(<em>'x-tree'</em>);
        <b>this</b>.innerCt = <b>this</b>.body.createChild({tag:&quot;ul&quot;,
               cls:&quot;x-tree-root-ct &quot; +
               (<b>this</b>.useArrows ? <em>'x-tree-arrows'</em> : <b>this</b>.lines ? &quot;x-tree-lines&quot; : &quot;x-tree-no-lines&quot;)});
    },

    <i>// private</i>
    initEvents : <b>function</b>(){
        Ext.tree.TreePanel.superclass.initEvents.call(<b>this</b>);

        <b>if</b>(this.containerScroll){
            Ext.dd.ScrollManager.register(<b>this</b>.body);
        }
        <b>if</b>((<b>this</b>.enableDD || <b>this</b>.enableDrop) &amp;&amp; !<b>this</b>.dropZone){
           <i>/**
            * The dropZone used by <b>this</b> tree <b>if</b> drop is enabled
            * @property dropZone
            * @type Ext.tree.TreeDropZone
            */</i>
             <b>this</b>.dropZone = <b>new</b> Ext.tree.TreeDropZone(<b>this</b>, <b>this</b>.dropConfig || {
               ddGroup: <b>this</b>.ddGroup || &quot;TreeDD&quot;, appendOnly: <b>this</b>.ddAppendOnly === true
           });
        }
        <b>if</b>((<b>this</b>.enableDD || <b>this</b>.enableDrag) &amp;&amp; !<b>this</b>.dragZone){
           <i>/**
            * The dragZone used by <b>this</b> tree <b>if</b> drag is enabled
            * @property dragZone
            * @type Ext.tree.TreeDragZone
            */</i>
            <b>this</b>.dragZone = <b>new</b> Ext.tree.TreeDragZone(<b>this</b>, <b>this</b>.dragConfig || {
               ddGroup: <b>this</b>.ddGroup || &quot;TreeDD&quot;,
               scroll: <b>this</b>.ddScroll
           });
        }
        <b>this</b>.getSelectionModel().init(<b>this</b>);
    },

    <i>// private</i>
    afterRender : <b>function</b>(){
        Ext.tree.TreePanel.superclass.afterRender.call(<b>this</b>);
        <b>this</b>.root.render();
        <b>if</b>(!<b>this</b>.rootVisible){
            <b>this</b>.root.renderChildren();
        }
    },

    onDestroy : <b>function</b>(){
        <b>if</b>(this.rendered){
            <b>this</b>.body.removeAllListeners();
            Ext.dd.ScrollManager.unregister(<b>this</b>.body);
            <b>if</b>(this.dropZone){
                <b>this</b>.dropZone.unreg();
            }
            <b>if</b>(this.dragZone){
               <b>this</b>.dragZone.unreg();
            }
        }
        <b>this</b>.root.destroy();
        <b>this</b>.nodeHash = null;
        Ext.tree.TreePanel.superclass.onDestroy.call(<b>this</b>);
    }
    
    <i>/** 
     * @cfg {String/Number} activeItem 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Boolean} autoDestroy 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Object/String/Function} autoLoad 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Boolean} autoWidth 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Boolean/Number} bufferResize 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {String} defaultType 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Object} defaults 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Boolean} hideBorders 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Mixed} items 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {String} layout 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Object} layoutConfig 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @cfg {Boolean} monitorResize 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @property items 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method cascade 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method doLayout 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method find 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method findBy 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method findById 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method findByType 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method getComponent 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method getLayout 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method getUpdater 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method insert 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method load 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method remove 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @event add 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @method removeAll
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @event afterLayout 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @event beforeadd 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @event beforeremove 
     * @hide 
     */</i>
<i>// holder</i>
<i>/*** 
     * @event remove 
     * @hide 
     */</i>
<i>// holder</i>
<i>/***
     * @cfg {String} allowDomMove  @hide
     */</i>
<i>// holder</i>
<i>/***
     * @cfg {String} autoEl @hide
     */</i>
<i>// holder</i>
<i>/***
     * @cfg {String} applyTo  @hide
     */</i>
<i>// holder</i>
<i>/***
     * @cfg {String} contentEl  @hide
     */</i>
<i>// holder</i>
<i>/***
     * @cfg {String} disabledClass  @hide
     */</i>
<i>// holder</i>
<i>/***
     * @cfg {String} elements  @hide
     */</i>
<i>// holder</i>
<i>/***
     * @cfg {String} html  @hide
     */</i>
<i>// holder</i>
<i>/***
     * @property disabled
     * @hide
     */</i>
<i>// holder</i>
<i>/***
     * @method applyToMarkup
     * @hide
     */</i>
<i>// holder</i>
<i>/***
     * @method enable
     * @hide
     */</i>
<i>// holder</i>
<i>/***
     * @method disable
     * @hide
     */</i>
<i>// holder</i>
<i>/***
     * @method setDisabled
     * @hide
     */</i>
});

Ext.tree.TreePanel.nodeTypes = {};

Ext.reg(<em>'treepanel'</em>, Ext.tree.TreePanel);</code></pre><hr><div style="font-size:10px;text-align:center;color:gray;">Ext - Copyright &copy; 2006-2007 Ext JS, LLC<br />All rights reserved.</div>
    </body></html>